package com.example.demo.smartLamp.controller;

import com.baomidou.mybatisplus.extension.service.IService;
import com.example.demo.common.ApiResponse;
import com.example.demo.smartLamp.VO.LightIdVo;
import com.example.demo.smartLamp.entity.STM32;
import com.example.demo.smartLamp.entity.request.AlarmRequest;
import com.example.demo.smartLamp.entity.response.GetAllEnvironmentResponse;
import com.example.demo.smartLamp.entity.response.STM32Response;
import com.example.demo.smartLamp.service.IEnvironmentService;
import com.example.demo.smartLamp.service.ISTM32Service;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/smartLamp/stm32")
public class STM32Controller {
    @Resource
    ISTM32Service stm32Service;

    @ApiOperation(value="获取STM32对应数据")
    @PostMapping("/getSTM32Info")
    public STM32Response getAllInfo() throws Exception {
        STM32Response Response = stm32Service.GetSTM32Info();
        return Response;
    }

    @ApiOperation(value="获取灯杆经纬度")
    @PostMapping("/getSTM32InfoGps")
    public ApiResponse getSTM32InfoGps(@RequestBody LightIdVo lightIdVo) throws Exception {
        return stm32Service.GetGps(lightIdVo.getLightId());
    }

    @ApiOperation(value="获取报警信息")
    @PostMapping("/getSTM32alarm")
    public ApiResponse getSTM32alarm(@RequestBody AlarmRequest alarmRequest) throws Exception {
        return stm32Service.getSTM32alarm(alarmRequest.getLampId());
    }


}
